package com.ruoyi.service.targets.impl;


import com.ruoyi.mapper.targets.TargetInfoMapper;
import com.ruoyi.service.targets.TargetInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class TargetInfoServiceImpl implements TargetInfoService {

    @Autowired
    TargetInfoMapper targetInfoMapper;

    @Override
    public List<Map<String, Object>> findTargetInfoAll(Map<String, Object> map) {
        return targetInfoMapper.findTargetInfoAll(map);
    }

    @Override
    public Map<String, Object> findTargetInfo(String targetId) {
        return targetInfoMapper.findTargetInfo(targetId);
    }

    @Override
    public int addTargetInfo(Map<String, Object> map) {
        return targetInfoMapper.addTargetInfo(map);
    }

    @Override
    public int editTargetInfo(Map<String, Object> map) {
        return targetInfoMapper.editTargetInfo(map);
    }

    @Override
    public int deleteTargetInfo(String targetId) {
        int num = 0;
        for (String str : targetId.split(",")) {
            num = targetInfoMapper.deleteTargetInfo(str);
            if (num == 0) return 0;
        }
        return num;
    }
}
